Network Analysis of the Redistricting Literature Data

# load data
literature <- here("Data",  "literature.csv") %>% 
  read_csv() %>% 
  filter(cite_weight > 0)

node_attributes <- read_csv(here("data", "node_attributes.csv"))

There are multiple packages to work with networks, but the most popular is igraph because it’s flexible and easy. Other packages include sna and networks.

To use igraph functions, we first need to create an igraph object. We can use the graph_from_data_frame function, which takes two arguments: d, a data frame with the edge list in the first two columns; and vertices, a data frame with node data with the node label in the first column. (igraph calls the nodes vertices, but it’s exactly the same thing.)

g <- graph_from_data_frame(d = literature %>% 
                        dplyr::select(from, to, everything())#, vertices =  node_attributes
                      )

g
## IGRAPH 5a589de DN-- 56 69 -- 
## + attr: name (v/c), core (e/l), edge (e/c), cites (e/c),
## | cites_empirical (e/c), mechanism (e/c), cite_weight (e/n),
## | cite_weight_empirical (e/n)
## + edges from 5a589de (vertex names):
## [1] computers                       ->detect gerrymandering           
## [2] computers                       ->public participation            
## [3] number of competitive districts ->preserve communities of interest
## [4] partisan advantage              ->proportionality                 
## [5] partisan gerrymandering         ->efficiency gap                  
## [6] preserve communities of interest->constitutional test             
## + ... omitted several edges
# attributes of the nodes
vertex_attr(g) %>% 
  as_tibble() %>% 
  kablebox()
name
computers
number of competitive districts
partisan advantage
partisan gerrymandering
preserve communities of interest
mean-median vote comparison
majority minority districts
redistricting commission
change in constituency boundaries
competitiveness
sorting
contiguity
electorate composition change
house-senate delegation alignment
stability in voters’ fellow constituents
voter information about their district
geographic partisan distribution
proportionality
compactness
efficiency gap
equal population
redistricting by courts
upcoming redistricting
partisan dislocation
wasted votes
identification with governing party
detect gerrymandering
public participation
constitutional test
instability
elite polarization
number of minority representatives
voter turnout
partisan donor advantage
legislator voting
legislative outcomes
incumbent vote share
personal vote
pork spending
voter sense of place
rolloff
split ticket voting
campaign resource allocation
floor votes align with district preferences
floor votes align with state preferences
minority representation
majority representation
elite ideological moderation
legislative majority-seeking behavior
candidate quality
efficiency principle
ideological representation
support for redistricting process
issue salience
degree of political conflict
inequality of opportunity vs outcome

From this igraph object, one can use igraph functions to generate network statistics. However, this involves several steps and the output is not tidy. To simplify generating network statistics from literature reviews, we introduce the netlit package.

Using the netlit R Package

The netlit package provides functions to generate network statistics from a literature review. Specifically, netlit provides a wrapper for igraph functions to facilitate using network analysis in literature reviews.

Install this package with

devtools::install_github("judgelord/netlit")

To install netlit from CRAN, run the following:

install.packages("netlit")

Basic Usage

The review() function takes in a dataframe, data, that includes from and to columns (a directed graph structure).

In the example below, we use example data from this project on redistricting. These data are a set of related concepts (from and to) in the redistricting literature and citations for these relationships (cites and cites_empirical). See vignette("netlit") for more details on this example.

library(netlit)

data("literature")

head(literature)
## # A tibble: 6 × 4
##   to                               from       cites            cites_empirical  
##   <chr>                            <chr>      <chr>            <chr>            
## 1 detect gerrymandering            computers  Altman & McDona… Wang 2016        
## 2 public participation             computers  Altman & McDona… <NA>             
## 3 preserve communities of interest number of… Gimpel & Harbri… Gimpel & Harbrid…
## 4 proportionality                  partisan … Caughey et al. … <NA>             
## 5 efficiency gap                   partisan … Chen 2017        Chen 2017        
## 6 constitutional test              preserve … Stephanopoulos … <NA>

netlit offers four functions: make_edgelist(), make_nodelist(), augment_nodelist(), and review().

review() is the primary function (and probably the only one you need). The others are helper functions that perform the individual steps that review() does all at once. review() takes in a dataframe with at least two columns representing linked concepts (e.g., a cause and an effect) and returns data augmented with network statistics. Users must either specify “from” nodes and “to” nodes with the from and to arguments or include columns named from and to in the supplied data object.

review() returns a list of three objects:

  1. an augmented edgelist (a list of relationships with edge_betweenness calculated),
  2. an augmented nodelist (a list of concepts with degree and betweenness calculated), and
  3. a graph object suitable for use in other igraph functions or other network visualization packages.

Users may wish to include edge attributes (e.g., information about the relationship between the two concepts) or node attributes (information about each concept). We show how to do so below. But first, consider the basic use of review():

lit <- review(literature, from = "from", to = "to")

lit
## A netlit_review object with the following components:
## 
## $edgelist
##  - 69 edges
##  - edge attributes: edge_betweenness
## $nodelist
##  - 57 nodes
##  - node attributes: degree, betweenness
## $graph
##    an igraph object
head(lit$edgelist)
## # A tibble: 6 × 3
##   from                             to                           edge_betweenness
##   <chr>                            <chr>                                   <dbl>
## 1 computers                        detect gerrymandering                     2  
## 2 computers                        public participation                      1  
## 3 number of competitive districts  preserve communities of int…             88  
## 4 partisan advantage               proportionality                          19.5
## 5 partisan gerrymandering          efficiency gap                           13.5
## 6 preserve communities of interest constitutional test                       7
head(lit$nodelist)
##                               node degree betweenness
## 1                        computers      0         0.0
## 2  number of competitive districts      1        66.0
## 3               partisan advantage      6       113.5
## 4          partisan gerrymandering      1        42.0
## 5 preserve communities of interest      2        81.0
## 6      mean-median vote comparison      0         0.0

Edge and node attributes can be added using the edge_attributes and node_attributes arguments. edge_attributes is a vector that identifies columns in the supplied data frame that the user would like to retain. node_attributes is a separate dataframe that contains attributes for each node in the primary data set. The example node_attributes data include one column type indicating a type for each each node/variable/concept.

data("node_attributes")

head(node_attributes)
## # A tibble: 6 × 2
##   node                                                                type     
##   <chr>                                                               <chr>    
## 1 Alignment of floor vote breakdown with statewide majority of voters effect   
## 2 bipartisan gerrymander                                              policy   
## 3 campaign resource allocation                                        effect   
## 4 campaign spending                                                   effect   
## 5 candidate quality                                                   effect   
## 6 change in constituency boundaries                                   condition
lit <- review(literature,
              edge_attributes = c("cites", "cites_empirical"),
              node_attributes = node_attributes)

lit
## A netlit_review object with the following components:
## 
## $edgelist
##  - 69 edges
##  - edge attributes: cites, cites_empirical, edge_betweenness
## $nodelist
##  - 57 nodes
##  - node attributes: type, degree, betweenness
## $graph
##    an igraph object
head(lit$edgelist)
## # A tibble: 6 × 5
##   from                             to     cites cites_empirical edge_betweenness
##   <chr>                            <chr>  <chr> <chr>                      <dbl>
## 1 computers                        detec… Altm… Wang 2016                    2  
## 2 computers                        publi… Altm… <NA>                         1  
## 3 number of competitive districts  prese… Gimp… Gimpel & Harbr…             88  
## 4 partisan advantage               propo… Caug… <NA>                        19.5
## 5 partisan gerrymandering          effic… Chen… Chen 2017                   13.5
## 6 preserve communities of interest const… Step… <NA>                         7
head(lit$nodelist)
##                               node      type degree betweenness
## 1                        computers condition      0         0.0
## 2               partisan advantage      goal      6       113.5
## 3          partisan gerrymandering condition      1        42.0
## 4 preserve communities of interest      goal      2        81.0
## 5      mean-median vote comparison    metric      0         0.0
## 6      majority minority districts    policy      0         0.0

Tip: to retain all variables from literature, use edge_attributes = names(literature).

More Advanced Uses

Additional columns in the redistricting literature data include discriptions of the edge (the relationship between the to and from concepts), the theorized mechanism, and cite_weight—the number of studies in the literature that cite that that causal relationship.

A Larger Edgelist and Nodelist

# load expanded dataset
literature <- read_csv(here::here("data", "literature.csv")) 

# clean up text for better visualization 
literature %<>% 
  mutate(cites = cites %>% str_remove(",.*|;.*"))

literature$to %<>% str_replace(" ", "\n") %>% str_replace(" ([A-z]*)$", "\n\\1") %>% str_to_title()

literature$from %<>% str_replace(" ", "\n") %>% str_replace(" ([A-z]*)$", "\n\\1") %>% str_to_title()

#literature %<>% drop_na(cite_weight)

literature$cite_weight %<>%  replace_na(0) # %>% as_factor()

literature %<>% mutate(partisan = str_c(to, from) %>% str_detect("Partisan"),
                       comm = str_c(to, from) %>% str_detect("Commun"),
              empirical = ifelse(!is.na(cites_empirical),
                                 "Empirical work", 
                                 "No empirical work"))

# now with all node and edge attributes 
lit <- review(literature,
              edge_attributes = names(literature),
              node_attributes = node_attributes
              )

edges <- lit$edgelist
kablebox(edges)
from to core edge cites cites_empirical mechanism cite_weight cite_weight_empirical partisan comm empirical edge_betweenness
Computers Detect Gerrymandering TRUE increases, imperfectly Altman & McDonald 2010 Wang 2016 Altman and McDonald (2010) argue that simulations cannot adequately detect gerrymanders. Wang proposes three tests to detect the effects and intents of gerrymanders. Altman and McDonald (2011) provide an open source program for redistricting analysis. Ramachandran & Gold argue that simulation-based measures (part of “outlier analysis”) are some of the only ways to effectively detect gerrymanders. 4 1 FALSE FALSE Empirical work 2.0
Computers Public Participation TRUE increases Altman & McDonald 2010 NA Altman & McDonald argue that computers can be used to allow the public to participate in the map-drawing process by soliciting information and education about redistricting. 2 0 FALSE FALSE No empirical work 1.0
Number Of Competitive Districts Preserve Communities Of Interest TRUE decreases if cor(party, community)>0 Gimpel & Harbridge-Yong 2020 Gimpel & Harbridge-Yong 2020 If racial groups or like municipal jurisdictions have partisan leanings, then creating more competitive districts often means splitting communities across districts. 1 1 FALSE TRUE Empirical work 86.0
Partisan Advantage Proportionality TRUE decreases Caughey et al. 2017 NA A partisan gerrymander aims to diverge from proportionality. 2 0 TRUE FALSE No empirical work 19.5
Partisan Gerrymandering Efficiency Gap TRUE increases Chen 2017 Chen 2017 Chen conducts simulations of neutrally drawn districts in Wisconsin and compares the efficiency gap of simulations to that of the actual redistricting plan, in order to show that the map was designed to give an advantage to one party. 1 1 TRUE FALSE Empirical work 13.5
Preserve Communities Of Interest Constitutional Test TRUE NA Stephanopoulos 2012 NA Stephanopoulos argues that the Supreme Court ought to adopt a test of political gerrymandering based on the “territorial community.” In short, if a district map disrupts an organic geographic community, it is unconstitutional. 1 0 FALSE TRUE No empirical work 7.0
Mean-Median Vote Comparison Detect Gerrymandering TRUE NA McDonald & Best 2015 Wang 2016b McDonald & Best propose a new measure of detecting gerrymanders; compare a party’s median vote share in a district to its mean vote share. Wang proposes a similar measure of gerrymandering based on comparing mean and median vote shares. 3 1 FALSE FALSE Empirical work 2.0
Mean-Median Vote Comparison Constitutional Test TRUE NA McDonald & Best 2015 NA McDonald & Best argue that their measure of gerryamndering can be extended to identify which gerrymanders are unconstitutional 1 0 FALSE FALSE No empirical work 1.0
Partisan Gerrymandering Constitutional Test TRUE NA Kang 2017 NA Kang argues that it is unconstitutional for the government to take partisanship into account when determining district lines 1 0 TRUE FALSE No empirical work 1.0
Partisan Gerrymandering Instability TRUE increases Yoshinaka & Murhpy 2011 Yoshinaka & Murhpy 2011 Partisan mapmakers can create political instability, particularly for their opponent legislators, by breaking the link between representatives and constituents 1 1 TRUE FALSE Empirical work 8.0
Partisan Gerrymandering Elite Polarization TRUE no effect Masket et al. 2012 Masket et al. 2012 Masket et al. find that partisan redistricting do not have much effect on legislative polarization, as it is swamped by other factors 1 1 TRUE FALSE Empirical work 2.0
Majority Minority Districts Number Of Minority Representatives TRUE increases Atsusaka 2021 Atsusaka 2021 Where minorities are a majority, they are have a better chance of electing a representative; Atsusaka 2021 creates a logical model that allows minority candidate appearance to be a result of (1) the electoral performance of coethnic candidates in the most recent elections and (2) the racial composition of a district. 1 1 FALSE FALSE Empirical work 1.0
Majority Minority Districts Partisan Advantage TRUE decreases Cox & Holden 2011 Sabouni & Shelton 2021 Cox and Holden argue that the optimal gerrymandering strategy is to cluster your strong partisan supporters into districts with a smaller number of strong partisan opponents. Thus, the Voting Rights Act’s majority-minority districts limit Republicans’ ability to effectively gerrymander. Sabouni and Shelton find that states that must submit their maps for clearance under the VRA had greater consistency in maps before and after the 2010 redistricting wave. 2 1 TRUE FALSE Empirical work 23.0
Majority Minority Districts Voter Turnout TRUE increases Fraga 2016 Fraga 2016 African Americans are more likely to vote when reassigned to a majority black district. Fraga relies on a theoretical “empowerment framework,” in which members of minority groups are more likely to participate when their group has representation and influence in politics. 1 1 FALSE FALSE Empirical work 1.0
Redistricting Commission Partisan Advantage TRUE decrease Cain 2011 NA Cain argues that independent citizen redistricting commissions are less likely to produce extremely partisan maps because they need to satisfy a supermajority by compromising on various redistricting criteria. 1 0 TRUE FALSE No empirical work 22.0
Partisan Gerrymandering Partisan Donor Advantage NA increases Kirkland 2013 Kirkland 2013 Parties care about other resources in addition to votes, such as donations. They can use redistricting to concentrate likely donors into their districts and remove them from opponents’ districts, thus increasing their odds of reelection. 1 1 TRUE FALSE Empirical work 8.0
Change In Constituency Boundaries Legislator Voting NA no effect, affects Bertelli & Carson 2011 Bertelli & Carson 2011, Hayes et al. 2010 Bertelli and Carson argue that partisan gerrymandering is a form of risk-sharing, in which individual members do not have to radically change their positions while maintaining their odds of reelection. In contrast, Hayes et al. say that legislators respond to the demographic changes of their constituency after redistricting. 1 1 FALSE FALSE Empirical work 1.0
Change In Constituency Boundaries Legislative Outcomes NA affects Bertelli & Carson 2011 Bertelli & Carson 2011 Bertelli & Carson: Partisan gerrymandering helps the majority party achieve its policy goals by increasing the odds of electoral success without requiring much sacrifice by individual members. Gul & Pesendorfer: use formal theory to show that policy outcomes are biased towards the redistricting party 1 1 FALSE FALSE Empirical work 1.0
Competitiveness Voter Turnout NA no effect Moskowitz & Schneer 2019 Moskowitz & Schneer 2019; Hunt 2018 Moskowitz & Schneer 2019: Residents of competitive districts systematically differ from those in non-competitive districts, leading cross-sectional studies to erroneously find a relationship between competitiveness and turnout. In addition, most voters aren’t aware of the competitiveness of their House race. Hunt 2018: examines data from Florida during 2012 election and finds that change in competitiveness after redistricting has a small effect on turnout 2 2 FALSE FALSE Empirical work 3.0
Sorting Elite Polarization NA increases Krasa & Polborn 2018 Krasa & Polborn 2018 Krasa & Polborn 2018: electoral competition model where gerrymandering (“intensification of the median ideological preferences in some districts”) can result in increased partisan polarization 1 1 FALSE FALSE Empirical work 1.0
Contiguity Partisan Advantage NA increases Chen & Rodden 2013 Chen & Rodden 2013 Democrats’ concentration in cities leads to a Republican bias, due to the geographic, majoritarian nature of U.S. elections. 1 1 TRUE FALSE Empirical work 24.0
Electorate Composition Change Incumbent Vote Share NA decreases Hood & McKee 2013 Hood & McKee 2013; Ansolabehere & Snyder 2012 Hood and McKee find that redistricting destroys the connection between a representative and their constituents; the new constituents have no such bond, so incumbency advantage is lower. Ansolabehere and Snyder find similar results when comparing the vote margins of districted and non-districted incumbents. 2 2 FALSE FALSE Empirical work 2.0
Electorate Composition Change Personal Vote NA decreases Carsey et al. 2017 Carsey et al. 2017 When a legislator’s district changes, the personal connection with some of their constituents is lost. Thus, legislators are less able to convert supporters of the opposite party, as they have no connections with their new constituents. 1 1 FALSE FALSE Empirical work 2.0
House-Senate Delegation Alignment Pork Spending NA decreases Chen 2010 NA NA 1 0 FALSE FALSE No empirical work 12.0
Stability In Voters’ Fellow Constituents Voter Sense Of Place NA increases heterogeneously by race Hayes & McKee 2011 Hayes & McKee 2011 NA 1 1 FALSE FALSE Empirical work 9.0
Change In Constituency Boundaries Voter Information About Their District NA affects Winburn & Wagner 2010 NA NA 1 0 FALSE FALSE No empirical work 4.0
Voter Information About Their District Rolloff NA decreases Winburn & Wagner 2010 Winburn & Wagner 2010 NA 1 1 FALSE FALSE Empirical work 2.0
Voter Information About Their District Voter Turnout NA decreases Winburn & Wagner 2010 Winburn & Wagner 2010 NA 1 1 FALSE FALSE Empirical work 8.0
Voter Information About Their District Split Ticket Voting NA increases Winburn & Wagner 2010 Winburn & Wagner 2010 NA 1 1 FALSE FALSE Empirical work 10.0
Electorate Composition Change Campaign Resource Allocation NA no effect Limbocker & You 2020 Limbocker & You 2020 Candidates have their own campaign style, so their resource allocation decisions do not change even when the electoral circumstances change. 1 1 FALSE FALSE Empirical work 2.0
Geographic Partisan Distribution Partisan Advantage NA affects Chen & Rodden 2013 Chen & Rodden 2013; Duchin et al. 2019; Powell et al. 2020 Chen & Rodden 2013: Democrats are geographically clustered which is electorally disadvantageous; they run up the score in large cities which leads to a discrepency between total vote share and seat share. Duchin et al. 2019: Republicans in Massachusetts are evenly distributed across the state, so they can get 30-40% of the statewide vote, but never win a single House seat. Powell et al. 2020: Also find that geographic clustering plays a role in the discrepency between total vote share and seat distribution in the House. 3 3 TRUE FALSE Empirical work 24.0
Preserve Communities Of Interest Stability In Voters’ Fellow Constituents NA increases Winburn & Wagner 2010 NA NA 1 0 FALSE TRUE No empirical work 16.0
Preserve Communities Of Interest Voter Information About Their District NA increases Winburn & Wagner 2010 NA NA 1 0 FALSE TRUE No empirical work 22.0
Preserve Communities Of Interest Rolloff NA decreases heterogeneously by race Hayes & McKee 2011 Hayes & McKee 2011 NA 2 1 FALSE TRUE Empirical work 8.0
Number Of Competitive Districts Elite Polarization NA decreases Grainger 2010 Grainger 2010 Safe partisan seats tend to increase partisan polarization. 1 1 FALSE FALSE Empirical work 1.0
Partisan Advantage Floor Votes Align With District Preferences NA decreases Caughey et al. 2017 NA TODO 1 0 TRUE FALSE No empirical work 8.0
Partisan Advantage Floor Votes Align With State Preferences NA decreases Caughey et al. 2017 NA TODO 1 0 TRUE FALSE No empirical work 8.0
Partisan Advantage Partisan Advantage NA NA Arrington 2016 NA Measures of partisan symmetry/bias/advantage 3 0 TRUE FALSE No empirical work 0.0
Partisan Advantage Legislator Voting NA no effect Lo 2013 Lo 2013 Legislators do not change their ideological positions after redistricting (though The Electoral Connection suggests they should) 1 1 TRUE FALSE Empirical work 8.0
Partisan Advantage Elite Polarization NA no effect Lo 2013 NA Because vulnerable legislators do not moderate their positions, Lo assumes that safe legislators do not become more extreme 1 0 TRUE FALSE No empirical work 5.0
Partisan Advantage Efficiency Gap NA no effect Chen & Cottrell 2016 Chen & Cottrell 2016 Gerrymandering does not affect the electoral results in most states, and in the states where it does have an effect, the effect is small. Republicans are expected to net only one additional seat in Congress due to gerrymandering. 1 1 TRUE FALSE Empirical work 15.0
Partisan Advantage Number Of Competitive Districts NA increases Goedert 2017 Goedert 2017, Yoshinaka & Murhpy 2011; Goedert 2014 Large changes in the national partisan tide causes garrymanders to backfire on the map-drawing party (an effect known as the “dummymander”), as their members face unexpectedly competitive elections. 2 2 TRUE FALSE Empirical work 71.0
Proportionality House-Senate Delegation Alignment NA increases Chen 2010 NA NA 1 0 FALSE FALSE No empirical work 22.0
Compactness Minority Representation NA decreases Webster 2013 NA Webster 2013: citing earlier research, Webster posits that compactness hinders a map drawer’s ability to create districts for historically underrepresented groups. 1 0 FALSE FALSE No empirical work 1.0
Compactness Compactness NA NA Barnes & Solomon 2020 Barnes & Solomon 2020; Magleby & Mosesson 2018; De Assis et al. 2014; Chen & Rodden 2015, Tam Cho & Liu 2016, Saxon 2020 Barnes & Solomon 2020: measuring compactness can have associated flexibility that can be abused (geography, topography, cartographic projections, and resolution); Gatesman & Unwin 2021: lattice models for accounting gerrymandered, equal-pop, connected districts; Magleby & Mosesson 2018: graph partition algorithm for drawing districts based on compactness and equal population metrics.De Assis et al. 2014: Greedy randomized adaptive search procedure can balance multiple criteria, including compactness. Altman & McDonald 2011: produce an open source package that allows users to adjust weights of redistricting criteria, including redistricting. Liu et al.; propose a method of parallel evolutionary computation to solve the optimization problem of redistricting. Chen & Rodden; simulation-based method also takes compactness into account to draw district maps and identify gerrymanders. Tam Cho & Liu; use compactness in their redistricting algorithm. Saxon 2020: software for applying compactness/contiguity/equipopulation objectives to evaluate maps – specific focus on different definitions of compactness. 6 4 FALSE FALSE Empirical work 0.0
Efficiency Gap Efficiency Gap NA NA Stephanopoulos & McGhee 2015 McGhee 2014 Stephanopoulos and McGhee propose a measure of partisan symmetry to be adopted by the courts, in order to limit partisan influence over redistricting; McGhee distinguishes efficiency from related concepts of symmetry and responsiveness 1 1 FALSE FALSE Empirical work 0.0
Equal Population Equal Population NA NA Gatesman & Unwin 2021 Magleby & Mosesson 2018 Gatesman & Unwin 2021: lattice models for accounting gerrymandered, equal-pop, connected districts; Magleby & Mosesson 2018: graph partition algorithm for drawing districts based on compactness and equal population metrics. Altman & McDonald 2011: produce an open source package that allows users to adjust weights of redistricting criteria, including equality of population 2 1 FALSE FALSE Empirical work 0.0
Redistricting Commission Majority Representation NA no effect Matsusaka 2010 Matsusaka 2010 Matsusaka does not discuss a mechanism for this relationship, but finds that other electoral rules, such as campaign finance regulations and ballot access rules, are also not associated with greater congruence between public opinion and legislative behavior. 1 1 FALSE FALSE Empirical work 1.0
Redistricting Commission Elite Ideological Moderation NA increases McGhee & Shor 2017 McGhee & Shor 2017 McGhee and Shor focus on the effect of the Top Two primary on elite moderation, but argue that the introduction of independent redistricting commissions may also lead to greater moderation by creating more competitive districts. 1 1 FALSE FALSE Empirical work 1.0
Redistricting Commission Competitiveness NA increases, no effect Carson et al. 2014 Carson et al. 2014, Grainger 2010, Masket et al. 2012; Goedert 2014 Carson et al.: increased ideological polarization and the availability of redistricting computer software encourages elites to draw non-competitive districts in order to increase their odds of reelection. Masket et al.: partisan redistricting does not effect competition much and is swamped by other factors. Williamson 2019: redistricting commissions produce fewer uncontested elections, relative to partisan redistrcting. 2 2 FALSE FALSE Empirical work 2.0
Redistricting By Courts Competitiveness NA increases Carson et al. 2014 Carson et al. 2014 NA 1 1 FALSE FALSE Empirical work 2.0
Upcoming Redistricting Legislative Majority-Seeking Behavior NA increases Makse 2014 Makse 2014 Parties have a greater incentive to become the majority party in the state legislature if redistricting is imminent and controlled by the legislature, as they can then determine the new district boundaries 1 1 FALSE FALSE Empirical work 1.0
Partisan Dislocation Partisan Dislocation NA NA Deford NA Deford, Eubank & Rodden 2020: new measure “partisan dislocation” which proxies for cracking/packing 1 0 TRUE FALSE No empirical work 0.0
Compactness Voter Turnout NA NA Ladewig 2018 Ladewig 2018 Ladewig 2018 posits and tests that geographical compactness can affect electoral turnout, and tests this on two redistricting cycles. Posited mechanisms include functional ones (easier linkage between politicians and constituents), institutional (decreased investment in non-salient elections, which are brought about by weakened tied communities that are not compact) and normative (citizens who live in gerrymandered districts might be less invested in democratic process). 1 1 FALSE FALSE Empirical work 1.0
Preserve Communities Of Interest Preserve Communities Of Interest NA NA Makse 2012 Makse 2012 Makse 2012 proposes using initiative data at polling station to get at latent patterns of voting in districts as a way to measure communities of interest. 1 1 FALSE TRUE Empirical work 0.0
Partisan Gerrymandering Partisan Advantage NA increases Wang 2016 Cox & Holden 2011; Sabouni & Shelton 2021; Powell et al. 2020 The party in charge of the redistricting process draws maps to secure an electoral advantage. 4 3 TRUE FALSE Empirical work 25.5
Preserve Communities Of Interest Partisan Gerrymandering NA decreases Sabouni & Shelton 2021 Sabouni & Shelton 2021 Some traditional districting principles, like preserving communities of interest, can constrain partisan gerrymandering. Authors measure this by examining the degree of overlap of districts before and after the 2010 wave of redistricting. 1 1 TRUE TRUE Empirical work 49.0
Redistricting Commission Candidate Quality NA increases Williamson 2019 Williamson 2019 Commission-based redistricting leads to more races with quality candidates (candidates who have held office previously), because quality candidates are more confident that they can win if the map has not been subject to partisan manipulation. 1 1 FALSE FALSE Empirical work 1.0
Efficiency Gap Efficiency Principle NA fails Veomett 2018 NA Veomett 2018 shows that, under unequal voter turnout, the efficiency gap does not satisfy the efficiency principle (it cannot distinguish between two outcomes, in which a party receives the same vote share but different seat shares). 1 0 FALSE FALSE No empirical work 10.0
Wasted Votes Efficiency Gap NA increases McGhee 2017 NA Only measures based on wasted votes can capture the concept of the efficiency gap. Symmetry-based measures fail to capture the concept. 1 0 FALSE FALSE No empirical work 6.0
Efficiency Gap Ideological Representation NA affects Caughey et al. 2017b Caughey et al. 2017b A higher efficiency gap indicates that one party gains additional seats in the legislature, which can then be used to achieve the party’s policy goals. 1 1 FALSE FALSE Empirical work 10.0
Identification With Governing Party Support For Redistricting Process NA increases Fougere et al. 2010 Fougere et al. 2010 Survey respondents who identify with the party in control of their state government are more likely to approve of their redistricting process and view it as fair. 1 1 FALSE FALSE Empirical work 1.0
Redistricting Commission Support For Redistricting Process NA increases Fougere et al. 2010 Fougere et al. 2010 Survey respondents living in states with partisan control over the redistricting process were less likely to view the process as fair. 1 1 FALSE FALSE Empirical work 1.0
Efficiency Gap Proportionality NA NA Warrington 2018 NA Warrington argues that the efficiency gap metric reduces to proportional representation, which is not a constitutional right. Therefore, the efficiency gap is not a useful metric for identifying unconstitutional gerrymanders. 1 0 FALSE FALSE No empirical work 10.5
Change In Constituency Boundaries Issue Salience NA affects Gardner 2012 NA Because we divide the electorate according to geography, local issues (issues of place) become more important than issues that are unrelated to place. 1 0 FALSE FALSE No empirical work 1.0
Change In Constituency Boundaries Degree Of Political Conflict NA affects Gardner 2012 NA Districts can be drawn such that the electorate within each district is homogeneous or heterogeneous (along some relevant political dimension). The more heterogeneous the district, the greater likelihood of political conflict. 1 0 FALSE FALSE No empirical work 1.0
Partisan Gerrymandering Majority Representation NA affects Goedert 2014 NA Goedert 2014: The type of gerrymander (bipartisan, nonpartisan, partisan) can affect two aspects of representation: bias and responsiveness. Nagle 2019: Gerrymandering in Pennsylvania hinders responsiveness, so responsiveness ought to be its own redistricting criteria. 2 0 TRUE FALSE No empirical work 7.0
Detect Gerrymandering Inequality Of Opportunity Vs Outcome NA NA Wang et al. 2018 NA Wang et al. 2018: We can divide measures of gerrymandering into two categories: those that identify inequality of opportunity and those that identify inequality of outcome 1 0 FALSE FALSE No empirical work 3.0
Change In Constituency Boundaries Electorate Composition Change NA increases Bertelli & Carson 2011 Bertelli & Carson 2011; Hood & McKee 2013; Ansolabehere & Snyder 2012 Changing the boundaries of a district will necessarily change who is in the district, but the reverse is not necessarily true. An electorate can change without the district boundaries changing. This relationship is not directly tested, but we assume it is true. 3 3 FALSE FALSE Empirical work 4.0
nodes <- lit$nodelist
kablebox(nodes)
node type degree betweenness
Computers NA 0 0.0
Number Of Competitive Districts NA 1 64.0
Partisan Advantage NA 6 111.5
Partisan Gerrymandering NA 1 42.0
Preserve Communities Of Interest NA 2 79.0
Mean-Median Vote Comparison NA 0 0.0
Majority Minority Districts NA 0 0.0
Redistricting Commission NA 0 0.0
Change In Constituency Boundaries NA 0 0.0
Competitiveness NA 2 2.0
Sorting NA 0 0.0
Contiguity NA 0 0.0
Electorate Composition Change NA 1 3.0
House-Senate Delegation Alignment NA 1 11.0
Stability In Voters’ Fellow Constituents NA 1 8.0
Voter Information About Their District NA 2 17.0
Geographic Partisan Distribution NA 0 0.0
Proportionality NA 2 20.0
Compactness NA 1 0.0
Efficiency Gap NA 4 25.5
Equal Population NA 1 0.0
Redistricting By Courts NA 0 0.0
Upcoming Redistricting NA 0 0.0
Partisan Dislocation NA 1 0.0
Wasted Votes NA 0 0.0
Identification With Governing Party NA 0 0.0
Detect Gerrymandering NA 2 2.0
Public Participation NA 1 0.0
Constitutional Test NA 3 0.0
Instability NA 1 0.0
Elite Polarization NA 4 0.0
Number Of Minority Representatives NA 1 0.0
Voter Turnout NA 4 0.0
Partisan Donor Advantage NA 1 0.0
Legislator Voting NA 2 0.0
Legislative Outcomes NA 1 0.0
Incumbent Vote Share NA 1 0.0
Personal Vote NA 1 0.0
Pork Spending NA 1 0.0
Voter Sense Of Place NA 1 0.0
Rolloff NA 2 0.0
Split Ticket Voting NA 1 0.0
Campaign Resource Allocation NA 1 0.0
Floor Votes Align With District Preferences NA 1 0.0
Floor Votes Align With State Preferences NA 1 0.0
Minority Representation NA 1 0.0
Majority Representation NA 2 0.0
Elite Ideological Moderation NA 1 0.0
Legislative Majority-Seeking Behavior NA 1 0.0
Candidate Quality NA 1 0.0
Efficiency Principle NA 1 0.0
Ideological Representation NA 1 0.0
Support For Redistricting Process NA 2 0.0
Issue Salience NA 1 0.0
Degree Of Political Conflict NA 1 0.0
Inequality Of Opportunity Vs Outcome NA 1 0.0

The igraph object

# define igraph object as g
g <- lit$graph
g
## IGRAPH 49c4732 DN-B 56 69 -- 
## + attr: name (v/c), type (v/c), degree (v/n), betweenness (v/n), core
## | (e/l), edge (e/c), cites (e/c), cites_empirical (e/c), mechanism
## | (e/c), cite_weight (e/n), cite_weight_empirical (e/n), partisan
## | (e/l), comm (e/l), empirical (e/c), edge_betweenness (e/n)
## + edges from 49c4732 (vertex names):
## [1] Computers                        ->Detect\nGerrymandering            
## [2] Computers                        ->Public\nParticipation             
## [3] Number\nOf Competitive\nDistricts->Preserve\nCommunities Of\nInterest
## [4] Partisan\nAdvantage              ->Proportionality                   
## [5] Partisan\nGerrymandering         ->Efficiency\nGap                   
## + ... omitted several edges

What does it mean?

  • D means directed
  • N means named graph
  • W means weighted graph
  • name (v/c) means name is a node attribute and it’s a character
  • cite_weight (e/n) means cite_weight is an edge attribute and it’s numeric

Network visualization with igraph::plot()

The plot() function works out of the box, but the default options are often not ideal:

plot(g)

For plotting options, you can check ?igraph.plotting. For example, we can set the vertex color, label colors, the size of the labels, curvature to the edge and edge color.

plot(g,
     vertex.color = "grey", # change color of nodes
     vertex.label.color = "black", # change color of labels
     vertex.label.cex = .25, # change size of labels to 25% of original size
     edge.curved=.25, # add a 25% curve to the edges
     arrow.size = .2,
     edge.color="grey20") # change edge color to grey

With ggnetwork

We can also plot using the package ggnetwork to tidy the igraph object so that we can use ggplot.

# install.packages("ggnetwork")
library(ggnetwork)

# use ggnetwork to tranform the igraph object into tidy data
n <- ggnetwork(g)


n2 <- n %>% filter(partisan) %>% mutate(partisan = FALSE)

n %<>% full_join(n2) %>% mutate(partisan = ifelse(partisan, "Mentions partisanship", "Other nodes"))

set.seed(12)

n$cite_weight %<>% as_factor()

# plot tidy network data
p <- ggplot(n) +
  aes(x = x, y = y, xend = xend, yend = yend,
      label = name %>% str_to_title()) +
    geom_nodes(size = 10, alpha = .1) +
    geom_edges(aes(color = cite_weight, linetype = empirical ),
               curvature = 0.1, 
               alpha = .8,
               #box.padding = unit(1, "lines"),
             arrow = arrow(length = unit(6, "pt"), type = "closed")) +
  
    geom_nodetext_repel(size = 2.3) +
  theme_blank() + 
  labs(color = "Number of\nPublications",
       linetype = "") + 
  scale_color_viridis_d(option = "plasma", begin = 0, end = .9, direction = -1) + 
  theme(legend.position="bottom")

p

# with edge text 
p <-  p + geom_edgetext(aes(label = cites_empirical %>% str_remove(",.*"), 
                    color = cite_weight),
                size = 2,
                alpha = .2) 

p


Facets retain node position:

p + facet_wrap("partisan")

Betweenness

# n
p <- ggplot(n) +
  aes(x = x, y = y, xend = xend, yend = yend,
      label = name) +
    geom_nodes(size = 10, alpha = .1) +
    geom_edges(aes(linetype = empirical ),
               curvature = 0.1, 
               alpha = .8,
               #box.padding = unit(1, "lines"),
             arrow = arrow(length = unit(6, "pt"), type = "closed")) +
  
    geom_nodetext_repel(size = 2.3) +
  theme_blank() + 
  labs(linetype = "") + 
  scale_color_viridis_c(option = "plasma", begin = 0, end = .9, direction = -1) + 
  theme(legend.position="bottom")
p + aes(color = edge_betweenness) + labs(color = "Edge Betweenness")

p + aes(color = betweenness) + labs(color = "Node Betweenness")

Degree

p + aes(color = degree) + labs(color = "Degree")


With gggraph

We can also plot using the package ggraph package to plot the igraph object.

This package allows us to plot self-ties, but it is more difficult to use ggplot features (e.g. colors and legend labels).

# install.packages("ggraph")
library(ggraph)

set.seed(12)

p <- ggraph(g, layout = 'fr') + 
  geom_node_point(size = 10, 
                  alpha = .1) + 
  geom_edge_arc2(aes(#start_cap = label_rect(node1.name),
    start_cap = circle(3, 'mm'),
    end_cap = circle(5, 'mm'),
    color = cite_weight %>% as_factor(),
    linetype = empirical),
    #alpha = .8,
    curvature = .1,
    arrow = arrow(length = unit(2, 'mm'), 
                  type = "closed")) + 
    geom_edge_loop(aes(color = cite_weight %>% as_factor()
                     )) +#color = "red") + 
  geom_node_text(aes(label = name), 
                 size = 2.3) + 
  theme_blank() + 
  theme(legend.position="bottom"        ) + 
  labs(edge_color = "Number of\nPublications",
       edge_linetype = "") + 
  #scale_edge_color_manual(values = "blues")
  #FIXME color scale
scale_edge_color_viridis(discrete = TRUE,
                         option = "plasma", begin = 0, end = .9, direction = -1) 

p 


Subgraphs

p + facet_wrap("comm")

Now modify some of these plotting attributes so that they are function of network properties. For example, a common adjustment is to change the size of the nodes and node labels so that they match their importance.

Betweenness

ggraph(g, layout = 'fr') + 
  geom_node_point(size = 10, 
                  alpha = .1) + 
  theme_blank() + 
  theme(legend.position="bottom"
        ) + 
  scale_color_viridis_c(begin = .5, end = 1, direction = -1, option = "cividis") + 
scale_edge_color_viridis(begin = 0.2, end = .9, direction = -1, option = "cividis")  +    
  geom_edge_arc2(aes(
    start_cap = circle(3, 'mm'),
    end_cap = circle(5, 'mm'),
    color = edge_betweenness,
    linetype = empirical),
    curvature = .1,
    arrow = arrow(length = unit(2, 'mm'), 
                  type = "closed")) + 
    geom_edge_loop(aes(color = edge_betweenness))  +
  geom_node_text(aes(label = name), 
                 size = 2.3) + 
  labs(edge_color = "Edge Betweenness",
       color = "Node Betweenness",
       edge_linetype = "") 

ggraph(g, layout = 'fr') + 
  geom_node_point(aes(color = betweenness),
                  size = 10, 
                  alpha = 1) + 
  theme_blank() + 
  theme(legend.position="bottom"        ) + 
  scale_color_viridis_c(begin = .5, end = 1, direction = -1, option = "cividis") + 
scale_edge_color_viridis(begin = 0.2, end = .9, direction = -1, option = "cividis")  +    
  geom_edge_arc2(aes(
    start_cap = circle(3, 'mm'),
    end_cap = circle(5, 'mm'),
    color = edge_betweenness,
    linetype = empirical),
    curvature = .1,
    arrow = arrow(length = unit(2, 'mm'), 
                  type = "closed")) + 
    geom_edge_loop(aes(color = edge_betweenness
                     )) +
  labs(edge_color = "Edge Betweenness",
       color = "Node Betweenness",
       edge_linetype = "") + 
  geom_node_text(aes(label = name), 
                 size = 2.3) 

Degree

ggraph(g, layout = 'fr') + 
  geom_node_point(aes(color = degree),
                  size = 10, 
                  alpha = 1) + 
  theme_blank() + 
  theme(legend.position="bottom"        ) + 
  scale_color_viridis_c(begin = .5, end = 1, direction = -1, option = "virdis") + 
scale_edge_color_viridis(begin = 0.2, end = .9, direction = -1, option = "cividis")  +    
  geom_edge_arc2(aes(
    start_cap = circle(3, 'mm'),
    end_cap = circle(5, 'mm'),
    color = edge_betweenness,
    linetype = empirical),
    curvature = .1,
    arrow = arrow(length = unit(2, 'mm'), 
                  type = "closed")) + 
    geom_edge_loop(aes(color = edge_betweenness
                     )) +
  labs(edge_color = "Edge Betweenness",
       color = "Degree",
       edge_linetype = "") + 
  geom_node_text(aes(label = name), 
                 size = 2.3) 


With visnetowrk

library(visNetwork)


# define function to plot
literature_plot <- function(lit){

  nodes <- lit$nodelist %>%
    mutate(id = node) %>% 
  filter(!is.na(id)) %>%
  distinct() %>%
    # removed nodes with multiple types
  add_count(id) %>% 
  filter(n == 1)

edges <- lit$edgelist %>% transmute(
  from = from,
  to = to,
  detail = paste(edge, mechanism, cites, sep = "<br>") %>% str_remove_all("NA"), 
  type = edge
) %>% 
  filter(!is.na(from),!is.na(to)) %>% 
  distinct()



# use betweeness to scale nodes
nodes$icon.size <-nodes$betweenness

# add attributes
nodes <- nodes %>% mutate(label = id, 
                          title = paste0("<p>", type, ": ", label,"</p>"),
                          # levels in case we want Hierarchical Layout
                          level = ifelse(type == "goal", 1:2, 3:4),
                          # FontAwesome.com shapes for fun
                          shape = "icon",
                            icon.color = case_when(type =="goal" ~ "black",
                                                   type !="goal" ~ "black"),
                            icon.code = case_when(type == "condition" ~ "f205", # chess board
                                                  type == "goal" ~ "f24e", # scale  "f05b", # crosshairs
                                                  type == "policy" ~ "f0e3", # gavel
                                                  type == "value" ~ "f004", # "f4be", # hand with heart
                                                  type == "effect" ~ "f080", # "f681", # data 
                                                  type == "metric" ~ "f1de",# "f548", # ruler 
                                                  TRUE ~ "f0c8"), #square
                            icon.face =  "'FontAwesome'",
                            icon.weight = "bold")

# format edges
edges <- edges %>% mutate(
  title = paste0("<p>", detail, "</p>"),
  #label = type,
  color = ifelse(str_detect(type, "^increase"), "#81a275", "#617d9f"),
  color = ifelse(str_detect(type, "^decrease"), "#b14552", color) ) 



# make directed graph
visNetwork(nodes=nodes, edges=edges, width = "100%") %>% 
  visEdges(width=5, color= edges$color, arrows = "to", arrowStrikethrough = F, smooth = T) %>%
  visNodes(scaling=list(min=40, max=50)) %>%
  visOptions(highlightNearest = list(enabled = T, degree = 1, hover = T)) %>%
  visInteraction(hover=TRUE, zoomView = TRUE) %>%
  #visHierarchicalLayout() %>% 
  visPhysics(solver = "forceAtlas2Based", forceAtlas2Based = list(gravitationalConstant = -50)) %>%
  addFontAwesome(name = "font-awesome-visNetwork") %>%
visLayout(randomSeed = 12) # to have always the same network  
}

The core nodes

core <- literature %>% filter(core)

core %<>% review(
  edge_attributes = names(core),
  node_attributes = node_attributes)

# plot core nodes
literature_plot(core)

The whole mess

# plot core nodes
literature_plot(lit)

Extra

Node properties

Let’s return to igraph functions to look at descriptive statistics at the node level. All of these are in some way measures of importance or centrality.

The most basic measure is degree, the number of adjacent edges to each node. It is often considered a measure of direct influence. In the redistricting network, it will be the unique number of concepts that each concept is interacting with. Sort the degree of the network and print it out.

sort(-degree(g)) %>% head() %>% kable()
x
Partisan Advantage -14
Partisan Gerrymandering -8
Preserve Communities Of Interest -8
Efficiency Gap -8
Redistricting Commission -6
Change In Constituency Boundaries -6

Partisan advantage (degree=14), followed by a three way tie of communities preserved, partisan gerrymandering and compactness (each degree=5) are the most “central” concepts covered in the redistricting literature.

In directed graphs, there are three types of degree: indegree (incoming edges), outdegree (outgoing edges), and total degree. You can find these using mode="in" or mode="out" or mode="total".

Strength is a weighted measure of degree that takes into account the number of edges that go from one node to another. In this network, it will be the total number of interactions of each concept with any other concept. Sort the strength of the network and print it out.

sort(-strength(g))  %>% head() %>% kable()
x
Partisan Advantage -14
Partisan Gerrymandering -8
Preserve Communities Of Interest -8
Efficiency Gap -8
Redistricting Commission -6
Change In Constituency Boundaries -6

Closeness measures how many steps are required to access every other node from a given node. It’s a measure of how long information takes to arrive (who hears news first?). Higher values mean less centrality. Sort the closeness of the network (normalize it) and print it out.

sort(-closeness(g, normalized=TRUE))
##                     Redistricting\nCommission 
##                                   -0.03459119 
##                 Majority\nMinority\nDistricts 
##                                   -0.03128555 
##                                    Contiguity 
##                                   -0.03026968 
##            Geographic\nPartisan\nDistribution 
##                                   -0.03026968 
##            Preserve\nCommunities Of\nInterest 
##                                   -0.02981030 
##                           Partisan\nAdvantage 
##                                   -0.02974581 
##                      Partisan\nGerrymandering 
##                                   -0.02972973 
##             Number\nOf Competitive\nDistricts 
##                                   -0.02952228 
##           Change\nIn Constituency\nBoundaries 
##                                   -0.02267106 
##                                 Wasted\nVotes 
##                                   -0.01994199 
##                               Efficiency\nGap 
##                                   -0.01958689 
##               Electorate\nComposition\nChange 
##                                   -0.01886792 
##      Voter\nInformation About Their\nDistrict 
##                                   -0.01886792 
##                                     Computers 
##                                   -0.01886145 
##                 Mean-Median\nVote\nComparison 
##                                   -0.01886145 
##                                   Compactness 
##                                   -0.01851852 
##                               Proportionality 
##                                   -0.01851229 
##                     Redistricting\nBy\nCourts 
##                                   -0.01851229 
##                               Competitiveness 
##                                   -0.01818182 
##                                       Sorting 
##                                   -0.01818182 
##           House-Senate\nDelegation\nAlignment 
##                                   -0.01818182 
##    Stability\nIn Voters' Fellow\nConstituents 
##                                   -0.01818182 
##                       Upcoming\nRedistricting 
##                                   -0.01818182 
##         Identification\nWith Governing\nParty 
##                                   -0.01818182 
##                        Detect\nGerrymandering 
##                                   -0.01818182 
##                             Equal\nPopulation 
##                                   -0.01785714 
##                         Partisan\nDislocation 
##                                   -0.01785714 
##                         Public\nParticipation 
##                                   -0.01785714 
##                          Constitutional\nTest 
##                                   -0.01785714 
##                                   Instability 
##                                   -0.01785714 
##                           Elite\nPolarization 
##                                   -0.01785714 
##          Number\nOf Minority\nRepresentatives 
##                                   -0.01785714 
##                                Voter\nTurnout 
##                                   -0.01785714 
##                    Partisan\nDonor\nAdvantage 
##                                   -0.01785714 
##                            Legislator\nVoting 
##                                   -0.01785714 
##                         Legislative\nOutcomes 
##                                   -0.01785714 
##                        Incumbent\nVote\nShare 
##                                   -0.01785714 
##                                Personal\nVote 
##                                   -0.01785714 
##                                Pork\nSpending 
##                                   -0.01785714 
##                        Voter\nSense Of\nPlace 
##                                   -0.01785714 
##                                       Rolloff 
##                                   -0.01785714 
##                         Split\nTicket\nVoting 
##                                   -0.01785714 
##                Campaign\nResource\nAllocation 
##                                   -0.01785714 
## Floor\nVotes Align With District\nPreferences 
##                                   -0.01785714 
##    Floor\nVotes Align With State\nPreferences 
##                                   -0.01785714 
##                      Minority\nRepresentation 
##                                   -0.01785714 
##                      Majority\nRepresentation 
##                                   -0.01785714 
##                Elite\nIdeological\nModeration 
##                                   -0.01785714 
##       Legislative\nMajority-Seeking\nBehavior 
##                                   -0.01785714 
##                            Candidate\nQuality 
##                                   -0.01785714 
##                         Efficiency\nPrinciple 
##                                   -0.01785714 
##                   Ideological\nRepresentation 
##                                   -0.01785714 
##           Support\nFor Redistricting\nProcess 
##                                   -0.01785714 
##                               Issue\nSalience 
##                                   -0.01785714 
##                Degree\nOf Political\nConflict 
##                                   -0.01785714 
##        Inequality\nOf Opportunity Vs\nOutcome 
##                                   -0.01785714

Detect gerrymandering, public participation, floor votes align with district preferences, and constitutional tests are closest to all other concepts in the network.

Betweenness measures brokerage or gatekeeping potential. It is (approximately) the number of shortest paths between nodes that pass through a particular node. Sort the betweenness of the network and print it out.

sort(-betweenness(g)) %>% head() %>% kable()
x
Partisan Advantage -111.5
Preserve Communities Of Interest -79.0
Number Of Competitive Districts -64.0
Partisan Gerrymandering -42.0
Efficiency Gap -25.5
Proportionality -20.0

Partisan advantage has by far the highest measure of brokerage/gatekeeping potential, followed by number of competitive districts. These two concepts allow for the fastest facilitation of ideas in the redistricting network; in other words, if we were to design a causal story and try to connect two concepts, the fastest way to connect them would most often be through the idea of partisan advantage.

Eigenvector centrality is a measure of being well-connected connected to the well-connected. First eigenvector of the graph adjacency matrix. Only works with undirected networks. Sort the returned vector from the eigen_centrality of the network and print it out. (not for this application)

sort(-eigen_centrality(g)$vector) %>% head() %>% kable()

Page rank approximates probability that any message will arrive to a particular node. This algorithm was developed by Google founders, and originally applied to website links. Sort the returned vector from the page_rank of the network and print it out.

sort(page_rank(g)$vector)
##                                     Computers 
##                                    0.01012114 
##                 Mean-Median\nVote\nComparison 
##                                    0.01012114 
##                 Majority\nMinority\nDistricts 
##                                    0.01012114 
##                     Redistricting\nCommission 
##                                    0.01012114 
##           Change\nIn Constituency\nBoundaries 
##                                    0.01012114 
##                                       Sorting 
##                                    0.01012114 
##                                    Contiguity 
##                                    0.01012114 
##            Geographic\nPartisan\nDistribution 
##                                    0.01012114 
##                     Redistricting\nBy\nCourts 
##                                    0.01012114 
##                       Upcoming\nRedistricting 
##                                    0.01012114 
##                                 Wasted\nVotes 
##                                    0.01012114 
##         Identification\nWith Governing\nParty 
##                                    0.01012114 
##               Electorate\nComposition\nChange 
##                                    0.01155497 
##                         Legislative\nOutcomes 
##                                    0.01155497 
##                Elite\nIdeological\nModeration 
##                                    0.01155497 
##                            Candidate\nQuality 
##                                    0.01155497 
##                               Issue\nSalience 
##                                    0.01155497 
##                Degree\nOf Political\nConflict 
##                                    0.01155497 
##                                   Instability 
##                                    0.01167278 
##                    Partisan\nDonor\nAdvantage 
##                                    0.01167278 
##                      Partisan\nGerrymandering 
##                                    0.01277826 
##    Stability\nIn Voters' Fellow\nConstituents 
##                                    0.01277826 
##          Number\nOf Minority\nRepresentatives 
##                                    0.01298879 
##                      Majority\nRepresentation 
##                                    0.01310661 
##                        Incumbent\nVote\nShare 
##                                    0.01339505 
##                                Personal\nVote 
##                                    0.01339505 
##                Campaign\nResource\nAllocation 
##                                    0.01339505 
## Floor\nVotes Align With District\nPreferences 
##                                    0.01406564 
##    Floor\nVotes Align With State\nPreferences 
##                                    0.01406564 
##             Number\nOf Competitive\nDistricts 
##                                    0.01406564 
##                                   Compactness 
##                                    0.01412252 
##                      Minority\nRepresentation 
##                                    0.01412252 
##                         Split\nTicket\nVoting 
##                                    0.01414790 
##      Voter\nInformation About Their\nDistrict 
##                                    0.01421209 
##                         Public\nParticipation 
##                                    0.01442262 
##                            Legislator\nVoting 
##                                    0.01549947 
##                         Efficiency\nPrinciple 
##                                    0.01665676 
##                   Ideological\nRepresentation 
##                                    0.01665676 
##                                       Rolloff 
##                                    0.01680502 
##                          Constitutional\nTest 
##                                    0.01863139 
##       Legislative\nMajority-Seeking\nBehavior 
##                                    0.01872411 
##                        Detect\nGerrymandering 
##                                    0.01872411 
##            Preserve\nCommunities Of\nInterest 
##                                    0.01875616 
##                               Competitiveness 
##                                    0.02015793 
##           Support\nFor Redistricting\nProcess 
##                                    0.02015793 
##                               Proportionality 
##                                    0.02060126 
##                        Voter\nSense Of\nPlace 
##                                    0.02098266 
##        Inequality\nOf Opportunity Vs\nOutcome 
##                                    0.02603663 
##           House-Senate\nDelegation\nAlignment 
##                                    0.02763221 
##                           Elite\nPolarization 
##                                    0.03019815 
##                               Efficiency\nGap 
##                                    0.03075588 
##                                Pork\nSpending 
##                                    0.03360852 
##                           Partisan\nAdvantage 
##                                    0.03712470 
##                                Voter\nTurnout 
##                                    0.03815118 
##                             Equal\nPopulation 
##                                    0.06747426 
##                         Partisan\nDislocation 
##                                    0.06747426

Authority score is another measure of centrality initially applied to the Web. A node has high authority when it is linked by many other nodes that are linking many other nodes. Sort the returned vector from the authority_score of the network and print it out.

sort(authority_score(g)$vector)
##                                     Computers 
##                                   0.000000000 
##                 Mean-Median\nVote\nComparison 
##                                   0.000000000 
##                 Majority\nMinority\nDistricts 
##                                   0.000000000 
##                     Redistricting\nCommission 
##                                   0.000000000 
##           Change\nIn Constituency\nBoundaries 
##                                   0.000000000 
##                                       Sorting 
##                                   0.000000000 
##                                    Contiguity 
##                                   0.000000000 
##           House-Senate\nDelegation\nAlignment 
##                                   0.000000000 
##            Geographic\nPartisan\nDistribution 
##                                   0.000000000 
##                             Equal\nPopulation 
##                                   0.000000000 
##                     Redistricting\nBy\nCourts 
##                                   0.000000000 
##                       Upcoming\nRedistricting 
##                                   0.000000000 
##                         Partisan\nDislocation 
##                                   0.000000000 
##                                 Wasted\nVotes 
##                                   0.000000000 
##         Identification\nWith Governing\nParty 
##                                   0.000000000 
##                        Incumbent\nVote\nShare 
##                                   0.000000000 
##                                Personal\nVote 
##                                   0.000000000 
##                                Pork\nSpending 
##                                   0.000000000 
##                        Voter\nSense Of\nPlace 
##                                   0.000000000 
##                Campaign\nResource\nAllocation 
##                                   0.000000000 
##       Legislative\nMajority-Seeking\nBehavior 
##                                   0.000000000 
##        Inequality\nOf Opportunity Vs\nOutcome 
##                                   0.000000000 
##                         Public\nParticipation 
##                                   0.002714762 
##                                   Compactness 
##                                   0.011232105 
##                      Minority\nRepresentation 
##                                   0.011232105 
##                         Split\nTicket\nVoting 
##                                   0.016561746 
##                        Detect\nGerrymandering 
##                                   0.033705631 
##               Electorate\nComposition\nChange 
##                                   0.050482441 
##                         Legislative\nOutcomes 
##                                   0.050482441 
##                               Issue\nSalience 
##                                   0.050482441 
##                Degree\nOf Political\nConflict 
##                                   0.050482441 
##                      Partisan\nGerrymandering 
##                                   0.060841510 
##    Stability\nIn Voters' Fellow\nConstituents 
##                                   0.060841510 
##                                       Rolloff 
##                                   0.077403255 
##          Number\nOf Minority\nRepresentatives 
##                                   0.090870705 
##                         Efficiency\nPrinciple 
##                                   0.103468618 
##                   Ideological\nRepresentation 
##                                   0.103468618 
##      Voter\nInformation About Their\nDistrict 
##                                   0.111323951 
##            Preserve\nCommunities Of\nInterest 
##                                   0.123762235 
##                                Voter\nTurnout 
##                                   0.128222187 
##                Elite\nIdeological\nModeration 
##                                   0.156303853 
##                            Candidate\nQuality 
##                                   0.156303853 
##                               Competitiveness 
##                                   0.168893077 
##           Support\nFor Redistricting\nProcess 
##                                   0.168893077 
##                                   Instability 
##                                   0.290225781 
##                    Partisan\nDonor\nAdvantage 
##                                   0.290225781 
##             Number\nOf Competitive\nDistricts 
##                                   0.313520447 
## Floor\nVotes Align With District\nPreferences 
##                                   0.313520447 
##    Floor\nVotes Align With State\nPreferences 
##                                   0.313520447 
##                            Legislator\nVoting 
##                                   0.364002888 
##                          Constitutional\nTest 
##                                   0.382058160 
##                               Proportionality 
##                                   0.416989065 
##                      Majority\nRepresentation 
##                                   0.446529634 
##                           Elite\nPolarization 
##                                   0.720362490 
##                               Efficiency\nGap 
##                                   0.764176242 
##                           Partisan\nAdvantage 
##                                   1.000000000

Finally, not exactly a measure of centrality, but we can learn more about who each node is connected to by using the following functions: neighbors (for direct neighbors) and ego (for neighbors up to n neighbors away). Find the neighbors of “partisan advantage”. Find the concept’s neighbors up to order 2 away.

neighbors(g, v=which(V(g)$name=="partisan advantage"))
## + 2/56 vertices, named, from 49c4732:
## [1] Detect\nGerrymandering Public\nParticipation
ego(g, order=2, nodes=which(V(g)$name=="partisan advantage"))
## list()

Network properties

Let’s now try to describe what a network looks like as a whole. We can start with measures of the size of a network. diameter is the length of the longest path (in number of edges) between two nodes. We can use get_diameter to identify this path. mean_distance is the average number of edges between any two nodes in the network. We can find each of these paths between pairs of edges with distances. Find the diameter and mean distances of the network.

diameter(g, directed=TRUE, weights=NA)
## [1] 6
get_diameter(g, directed=TRUE, weights=NA)
## + 7/56 vertices, named, from 49c4732:
## [1] Number\nOf Competitive\nDistricts   Preserve\nCommunities Of\nInterest 
## [3] Partisan\nGerrymandering            Partisan\nAdvantage                
## [5] Proportionality                     House-Senate\nDelegation\nAlignment
## [7] Pork\nSpending
mean_distance(g, directed=TRUE)
## [1] 2.59751
dist <- distances(g, weights=NA)
dist[1:5, 1:5]
##                                    Computers Number\nOf Competitive\nDistricts
## Computers                                  0                                 5
## Number\nOf Competitive\nDistricts          5                                 0
## Partisan\nAdvantage                        5                                 1
## Partisan\nGerrymandering                   4                                 2
## Preserve\nCommunities Of\nInterest         4                                 1
##                                    Partisan\nAdvantage Partisan\nGerrymandering
## Computers                                            5                        4
## Number\nOf Competitive\nDistricts                    1                        2
## Partisan\nAdvantage                                  0                        1
## Partisan\nGerrymandering                             1                        0
## Preserve\nCommunities Of\nInterest                   2                        1
##                                    Preserve\nCommunities Of\nInterest
## Computers                                                           4
## Number\nOf Competitive\nDistricts                                   1
## Partisan\nAdvantage                                                 2
## Partisan\nGerrymandering                                            1
## Preserve\nCommunities Of\nInterest                                  0

edge_density is the proportion of edges in the network over all possible edges that could exist. Find the edge_density of the network.

edge_density(g)
## [1] 0.0224026
# 22*21 possible edges / 2 because it's undirected = 231 possible edges
# but only 60 exist
60/((22*21)/2)
## [1] 0.2597403

reciprocity measures the propensity of each edge to be a mutual edge; that is, the probability that if i is connected to j, j is also connected to i. Find the reciprocity of the network – you should find that it is 1. Explain why you think reciprocity=1 in this case.

reciprocity(g)
## [1] 0

transitivity, also known as clustering coefficient, measures that probability that adjacent nodes of a network are connected. In other words, if i is connected to j, and j is connected to k, what is the probability that i is also connected to k? Find the transitivity of the network.

transitivity(g)
## [1] 0.0861244

Network communities

Networks often have different clusters or communities of nodes that are more densely connected to each other than to the rest of the network. Let’s cover some of the different existing methods to identify these communities.

The most straightforward way to partition a network is into connected components. Each component is a group of nodes that are connected to each other, but not to the rest of the nodes. For example, this network has two components.

# components(g)
par(mar=c(0,0,0,0)); plot(g)

Most networks have a single giant connected component that includes most nodes. Most studies of networks actually focus on the giant component (e.g. the shortest path between nodes in a network with two or more component is Inf!).

giant <- decompose(g)[[1]]

Components can be weakly connected (in undirected networks) or __strongly connected (in directed networks, where there is an edge that ends in every single node of that component).

Even within a giant component, there can be different subsets of the network that are more connected to each other than to the rest of the network. The goal of community detection algorithms is to identify these subsets.

There are a few different algorithms, each following a different logic.

The walktrap algorithm finds communities through a series of short random walks. The idea is that these random walks tend to stay within the same community. The length of these random walks is 4 edges by default, but you may want to experiment with different values. The goal of this algorithm is to identify the partition that maximizes a modularity score.

cluster_walktrap(giant)
## IGRAPH clustering walktrap, groups: 11, mod: 0.51
## + groups:
##   $`1`
##   [1] "Computers"                             
##   [2] "Mean-Median\nVote\nComparison"         
##   [3] "Detect\nGerrymandering"                
##   [4] "Public\nParticipation"                 
##   [5] "Inequality\nOf Opportunity Vs\nOutcome"
##   
##   $`2`
##   [1] "Majority\nMinority\nDistricts"           
##   [2] "Voter\nInformation About Their\nDistrict"
##   + ... omitted several groups/vertices
cluster_walktrap(giant, steps=10)
## IGRAPH clustering walktrap, groups: 7, mod: 0.55
## + groups:
##   $`1`
##   [1] "Change\nIn Constituency\nBoundaries"
##   [2] "Electorate\nComposition\nChange"    
##   [3] "Legislator\nVoting"                 
##   [4] "Legislative\nOutcomes"              
##   [5] "Incumbent\nVote\nShare"             
##   [6] "Personal\nVote"                     
##   [7] "Campaign\nResource\nAllocation"     
##   [8] "Issue\nSalience"                    
##   [9] "Degree\nOf Political\nConflict"     
##   + ... omitted several groups/vertices

Other methods are:

  • The fast and greedy method tries to directly optimize this modularity score.
  • The infomap method attempts to map the flow of information in a network, and the different clusters in which information may get remain for longer periods. Similar to walktrap, but not necessarily maximizing modularity, but rather the so-called “map equation”.
  • The edge-betweenness method iteratively removes edges with high betweenness, with the idea that they are likely to connect different parts of the network. Here betweenness (gatekeeping potential) applies to edges, but the intuition is the same.
  • The label propagation method labels each node with unique labels, and then updates these labels by choosing the label assigned to the majority of their neighbors, and repeat this iteratively until each node has the most common labels among its neighbors.
cluster_edge_betweenness(giant)
## IGRAPH clustering edge betweenness, groups: 17, mod: 0.44
## + groups:
##   $`1`
##   [1] "Computers"
##   
##   $`2`
##    [1] "Number\nOf Competitive\nDistricts"            
##    [2] "Partisan\nAdvantage"                          
##    [3] "Change\nIn Constituency\nBoundaries"          
##    [4] "Sorting"                                      
##    [5] "Elite\nPolarization"                          
##    [6] "Legislator\nVoting"                           
##   + ... omitted several groups/vertices
cluster_infomap(giant)
## IGRAPH clustering infomap, groups: 1, mod: 0
## + groups:
##   $`1`
##    [1] "Computers"                                    
##    [2] "Number\nOf Competitive\nDistricts"            
##    [3] "Partisan\nAdvantage"                          
##    [4] "Partisan\nGerrymandering"                     
##    [5] "Preserve\nCommunities Of\nInterest"           
##    [6] "Mean-Median\nVote\nComparison"                
##    [7] "Majority\nMinority\nDistricts"                
##    [8] "Redistricting\nCommission"                    
##    [9] "Change\nIn Constituency\nBoundaries"          
##   + ... omitted several groups/vertices
cluster_label_prop(giant)
## IGRAPH clustering label propagation, groups: 12, mod: 0.32
## + groups:
##   $`1`
##   [1] "Computers"                             
##   [2] "Detect\nGerrymandering"                
##   [3] "Public\nParticipation"                 
##   [4] "Inequality\nOf Opportunity Vs\nOutcome"
##   
##   $`2`
##    [1] "Number\nOf Competitive\nDistricts"            
##    [2] "Partisan\nAdvantage"                          
##    [3] "Partisan\nGerrymandering"                     
##   + ... omitted several groups/vertices

Infomap tends to work better in most social science examples (websites, social media, classrooms, etc), but fastgreedy is faster.

igraph also makes it very easy to plot the resulting communities:

# undirected graphs only
comm <- cluster_infomap(giant)
modularity(comm) # modularity score
par(mar=c(0,0,0,0)); plot(comm, giant)

Alternatively, we can also add the membership to different communities as a color parameter in the igraph object.

# for undirected graphs
V(giant)$color <- membership(comm)
par(mar=c(0,0,0,0)); plot(giant)

The final way in which we can think about network communities is in terms of hierarchy or structure. We’ll discuss one of these methods.

K-core decomposition allows us to identify the core and the periphery of the network. A k-core is a maximal subnet of a network such that all nodes have at least degree K.

coreness(g)
##                                     Computers 
##                                             1 
##             Number\nOf Competitive\nDistricts 
##                                             3 
##                           Partisan\nAdvantage 
##                                             3 
##                      Partisan\nGerrymandering 
##                                             3 
##            Preserve\nCommunities Of\nInterest 
##                                             3 
##                 Mean-Median\nVote\nComparison 
##                                             1 
##                 Majority\nMinority\nDistricts 
##                                             2 
##                     Redistricting\nCommission 
##                                             2 
##           Change\nIn Constituency\nBoundaries 
##                                             2 
##                               Competitiveness 
##                                             2 
##                                       Sorting 
##                                             1 
##                                    Contiguity 
##                                             1 
##               Electorate\nComposition\nChange 
##                                             1 
##           House-Senate\nDelegation\nAlignment 
##                                             1 
##    Stability\nIn Voters' Fellow\nConstituents 
##                                             1 
##      Voter\nInformation About Their\nDistrict 
##                                             2 
##            Geographic\nPartisan\nDistribution 
##                                             1 
##                               Proportionality 
##                                             2 
##                                   Compactness 
##                                             2 
##                               Efficiency\nGap 
##                                             3 
##                             Equal\nPopulation 
##                                             2 
##                     Redistricting\nBy\nCourts 
##                                             1 
##                       Upcoming\nRedistricting 
##                                             1 
##                         Partisan\nDislocation 
##                                             2 
##                                 Wasted\nVotes 
##                                             1 
##         Identification\nWith Governing\nParty 
##                                             1 
##                        Detect\nGerrymandering 
##                                             1 
##                         Public\nParticipation 
##                                             1 
##                          Constitutional\nTest 
##                                             2 
##                                   Instability 
##                                             1 
##                           Elite\nPolarization 
##                                             3 
##          Number\nOf Minority\nRepresentatives 
##                                             1 
##                                Voter\nTurnout 
##                                             2 
##                    Partisan\nDonor\nAdvantage 
##                                             1 
##                            Legislator\nVoting 
##                                             2 
##                         Legislative\nOutcomes 
##                                             1 
##                        Incumbent\nVote\nShare 
##                                             1 
##                                Personal\nVote 
##                                             1 
##                                Pork\nSpending 
##                                             1 
##                        Voter\nSense Of\nPlace 
##                                             1 
##                                       Rolloff 
##                                             2 
##                         Split\nTicket\nVoting 
##                                             1 
##                Campaign\nResource\nAllocation 
##                                             1 
## Floor\nVotes Align With District\nPreferences 
##                                             1 
##    Floor\nVotes Align With State\nPreferences 
##                                             1 
##                      Minority\nRepresentation 
##                                             1 
##                      Majority\nRepresentation 
##                                             2 
##                Elite\nIdeological\nModeration 
##                                             1 
##       Legislative\nMajority-Seeking\nBehavior 
##                                             1 
##                            Candidate\nQuality 
##                                             1 
##                         Efficiency\nPrinciple 
##                                             1 
##                   Ideological\nRepresentation 
##                                             1 
##           Support\nFor Redistricting\nProcess 
##                                             1 
##                               Issue\nSalience 
##                                             1 
##                Degree\nOf Political\nConflict 
##                                             1 
##        Inequality\nOf Opportunity Vs\nOutcome 
##                                             1
which(coreness(g)==6) # what is the core of the network?
## named integer(0)
which(coreness(g)==1) # what is the periphery of the network?
##                                     Computers 
##                                             1 
##                 Mean-Median\nVote\nComparison 
##                                             6 
##                                       Sorting 
##                                            11 
##                                    Contiguity 
##                                            12 
##               Electorate\nComposition\nChange 
##                                            13 
##           House-Senate\nDelegation\nAlignment 
##                                            14 
##    Stability\nIn Voters' Fellow\nConstituents 
##                                            15 
##            Geographic\nPartisan\nDistribution 
##                                            17 
##                     Redistricting\nBy\nCourts 
##                                            22 
##                       Upcoming\nRedistricting 
##                                            23 
##                                 Wasted\nVotes 
##                                            25 
##         Identification\nWith Governing\nParty 
##                                            26 
##                        Detect\nGerrymandering 
##                                            27 
##                         Public\nParticipation 
##                                            28 
##                                   Instability 
##                                            30 
##          Number\nOf Minority\nRepresentatives 
##                                            32 
##                    Partisan\nDonor\nAdvantage 
##                                            34 
##                         Legislative\nOutcomes 
##                                            36 
##                        Incumbent\nVote\nShare 
##                                            37 
##                                Personal\nVote 
##                                            38 
##                                Pork\nSpending 
##                                            39 
##                        Voter\nSense Of\nPlace 
##                                            40 
##                         Split\nTicket\nVoting 
##                                            42 
##                Campaign\nResource\nAllocation 
##                                            43 
## Floor\nVotes Align With District\nPreferences 
##                                            44 
##    Floor\nVotes Align With State\nPreferences 
##                                            45 
##                      Minority\nRepresentation 
##                                            46 
##                Elite\nIdeological\nModeration 
##                                            48 
##       Legislative\nMajority-Seeking\nBehavior 
##                                            49 
##                            Candidate\nQuality 
##                                            50 
##                         Efficiency\nPrinciple 
##                                            51 
##                   Ideological\nRepresentation 
##                                            52 
##           Support\nFor Redistricting\nProcess 
##                                            53 
##                               Issue\nSalience 
##                                            54 
##                Degree\nOf Political\nConflict 
##                                            55 
##        Inequality\nOf Opportunity Vs\nOutcome 
##                                            56
# Visualizing network structure
V(g)$coreness <- coreness(g)
par(mfrow=c(2, 3), mar=c(0.1,0.1,1,0.1))
set.seed(777); fr <- layout_with_fr(g)
for (k in 1:6){
  V(g)$color <- ifelse(V(g)$coreness>=k, "orange", "grey")
  plot(g, main=paste0(k, '-core shell'), layout=fr)
}

wc <- cluster_walktrap(g)
modularity(wc)
## [1] 0.5122873
membership(wc)
##                                     Computers 
##                                             1 
##             Number\nOf Competitive\nDistricts 
##                                             4 
##                           Partisan\nAdvantage 
##                                             4 
##                      Partisan\nGerrymandering 
##                                             4 
##            Preserve\nCommunities Of\nInterest 
##                                             4 
##                 Mean-Median\nVote\nComparison 
##                                             1 
##                 Majority\nMinority\nDistricts 
##                                             2 
##                     Redistricting\nCommission 
##                                             3 
##           Change\nIn Constituency\nBoundaries 
##                                             5 
##                               Competitiveness 
##                                             3 
##                                       Sorting 
##                                             4 
##                                    Contiguity 
##                                             4 
##               Electorate\nComposition\nChange 
##                                            10 
##           House-Senate\nDelegation\nAlignment 
##                                             8 
##    Stability\nIn Voters' Fellow\nConstituents 
##                                             6 
##      Voter\nInformation About Their\nDistrict 
##                                             2 
##            Geographic\nPartisan\nDistribution 
##                                             4 
##                               Proportionality 
##                                             4 
##                                   Compactness 
##                                            11 
##                               Efficiency\nGap 
##                                             9 
##                             Equal\nPopulation 
##                                            13 
##                     Redistricting\nBy\nCourts 
##                                             3 
##                       Upcoming\nRedistricting 
##                                            12 
##                         Partisan\nDislocation 
##                                            14 
##                                 Wasted\nVotes 
##                                             9 
##         Identification\nWith Governing\nParty 
##                                             7 
##                        Detect\nGerrymandering 
##                                             1 
##                         Public\nParticipation 
##                                             1 
##                          Constitutional\nTest 
##                                             4 
##                                   Instability 
##                                             4 
##                           Elite\nPolarization 
##                                             4 
##          Number\nOf Minority\nRepresentatives 
##                                             2 
##                                Voter\nTurnout 
##                                             2 
##                    Partisan\nDonor\nAdvantage 
##                                             4 
##                            Legislator\nVoting 
##                                             5 
##                         Legislative\nOutcomes 
##                                             5 
##                        Incumbent\nVote\nShare 
##                                            10 
##                                Personal\nVote 
##                                            10 
##                                Pork\nSpending 
##                                             8 
##                        Voter\nSense Of\nPlace 
##                                             6 
##                                       Rolloff 
##                                             2 
##                         Split\nTicket\nVoting 
##                                             2 
##                Campaign\nResource\nAllocation 
##                                            10 
## Floor\nVotes Align With District\nPreferences 
##                                             4 
##    Floor\nVotes Align With State\nPreferences 
##                                             4 
##                      Minority\nRepresentation 
##                                            11 
##                      Majority\nRepresentation 
##                                             3 
##                Elite\nIdeological\nModeration 
##                                             3 
##       Legislative\nMajority-Seeking\nBehavior 
##                                            12 
##                            Candidate\nQuality 
##                                             3 
##                         Efficiency\nPrinciple 
##                                             9 
##                   Ideological\nRepresentation 
##                                             9 
##           Support\nFor Redistricting\nProcess 
##                                             7 
##                               Issue\nSalience 
##                                             5 
##                Degree\nOf Political\nConflict 
##                                             5 
##        Inequality\nOf Opportunity Vs\nOutcome 
##                                             1
V(g)$shortname<-V(g)$name #shortened easier to read ver name
V(g)$shortname[V(g)$shortname=="concentration of likely donors in map-drawing party's districts"]<- "donor concentration"
V(g)$shortname[V(g)$shortname=="individual legislator voting"]<- "legislator voting"
V(g)$shortname[V(g)$shortname=="effect of personal vote"]<- "personal vote"
V(g)$shortname[V(g)$shortname=="detect gerrymandering"]<- "detect gerrymander"
V(g)$shortname[V(g)$shortname=="proportional minority representation"]<- "prop. minority rep"
V(g)$shortname[V(g)$shortname=="Number of competitive districts"]<- "no. competitive district"
V(g)$shortname[V(g)$shortname=="legislator information about district"]<- "legis. info on district"
V(g)$shortname[V(g)$shortname=="floor votes align with district preferences"]<- "legis. votes with district pref."
V(g)$shortname[V(g)$shortname=="stability in voters' fellow constituents"]<- "constituent stability"
V(g)$shortname[V(g)$shortname=="voter information about their district"]<- "voter info on district"
V(g)$shortname[V(g)$shortname=="legislator information seeking"]<- "legis. info-seek"
V(g)$shortname[V(g)$shortname=="Alignment of floor vote breakdown with statewide majority of voters"]<- "Floor vote align state voters"
V(g)$shortname[V(g)$shortname=="number of competitive districts" ]<- "no. competitive district" 
V(g)$shortname[V(g)$shortname=="House-Senate Delegation alignment" ]<- "Congress-SH align" 
V(g)$shortname[V(g)$shortname=="unconstitutional government interest"]<- "unconstit gov interest"
V(g)$shortname[V(g)$shortname=="number of minority representatives"]<- "no. minority reps"
V(g)$shortname[V(g)$shortname=="representation of majority opinion"]<- "represent majority opinion"
V(g)$shortname[V(g)$shortname=="elite ideological moderation"]<- "elite ideol moderation"
V(g)$shortname[V(g)$shortname=="partisan gerrymandering"]<- "partisan gerrymander"
V(g)$shortname[V(g)$shortname=="legislative majority-seeking behavior"]<- "legis majority-seeking behavior"
V(g)$shortname[V(g)$shortname=="change in constituency boundaries"]<- "change constituent boundary"
V(g)$shortname[V(g)$shortname=="demographic and ideological sorting"]<- "demog/ideol sorting"
V(g)$shortname[V(g)$shortname=="dispersed minority population"]<- "dispersed minority pop"
V(g)$shortname[V(g)$shortname=="majority minority districts"]<- "majority minority district"

set.seed(123)
pdf(file=here::here("figs","redistrict_communities.pdf"),width=13,height=13)
plot(g)
plot(wc, g, vertex.label=V(g)$shortname,vertex.label.dist=1,vertex.color="gray20")
dev.off()
## quartz_off_screen 
##                 2
plot(g)